<?php
/**
 * PC端更新检测
 * @author: Skiychan <dev@skiy.net>
 */

if (! defined ( 'BASEPATH' ))
    exit ( 'No direct script access allowed' );

class Update extends CI_Controller {

    public function index() {
        //取得版本号
        $ver = $this->input->get("client_version", TRUE);

        $last_version = $this->config->item("reader_version");
        $ver_url = $this->config->item("reader_download");

        $res = array(
            "res" => 0,
            "version" => $this->last_ver,
            "url" => site_url($ver_url)
        );

        if (version_compare($ver, $last_version,">=")) {
            $res['res'] = 1;
        }

        echo json_encode($res);
    }


}